// pages/cloudPatrol/detaily/KeyAreas/index.js
import {request,Modal} from "../../../../utils/util"
import {IMG_PATH,apiList,ApiRootUrl} from "../../../../config/index"
import Toast from '../../../../@vant/weapp/toast/toast';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    orgCode:'',
    processCode:'',
    xianchangImg:[
      "https://tse2-mm.cn.bing.net/th/id/OIP.dxmVhB7-H4rOyJ0l8eF3WwHaGq?pid=Api&rs=1",
      "https://tse2-mm.cn.bing.net/th/id/OIP.dxmVhB7-H4rOyJ0l8eF3WwHaGq?pid=Api&rs=1",
      "https://tse2-mm.cn.bing.net/th/id/OIP.dxmVhB7-H4rOyJ0l8eF3WwHaGq?pid=Api&rs=1"
    ],
    safeyImg:[
      "https://tse2-mm.cn.bing.net/th/id/OIP.dxmVhB7-H4rOyJ0l8eF3WwHaGq?pid=Api&rs=1",
      "https://tse2-mm.cn.bing.net/th/id/OIP.dxmVhB7-H4rOyJ0l8eF3WwHaGq?pid=Api&rs=1"
    ],
    feedback:"",
  },
  clickImg(e){
    console.log(e)
    let img =e.currentTarget.dataset.img
    wx.previewImage({
      urls: [img], //需要预览的图片http链接列表，注意是数组
      current: img, // 当前显示图片的http链接，默认是第一个
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let self=this
    console.log(options);
    self.setData({
      orgCode:options.orgCode,
      processCode:options.processCode
    })
    self.getDetail()
  },
  getDetail(e) {
    let self = this;

      let params = {
        processCode: self.data.processCode,
        orgCode: self.data.orgCode
      }
      Toast.loading({
        message: '加载中...',
        mask: true,
        duration: 0,
        forbidClick: true,
      });
      wx.request({
        url: `${ApiRootUrl}/cloudCheckTask/queryCloudTaskDetail`,
        method: 'GET',
        header: {
          'content-type': 'application/json; charset=utf-8',
          'cookie': wx.getStorageSync("sessionid")
        },
        params: params,
        data: params,
        success(res) {
          Toast.clear();
          if (res.data.code == 20000) {
            console.log(res);
          }else {
            Toast({
              duration: 3000,
              forbidClick: true,
              type: 'fail',
              message: res.data.message,
              mask:true
            });
          }
        },
        fail(res) {
          Toast.clear();
          Toast({
            duration: 3000,
            forbidClick: true,
            type: 'fail',
            message: '网络已断开',
          });
        }
      })
 
  },
  bindTextArea(e){
    this.setData({
      feedback:e.detail.value
    })
  },
  /**
   *  保存信息
   *   
   */
  update(){
    
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})